# coding=utf-8
import maya.cmds as cmds
import maya.mel as mel

def UvTilePreview():
	typeList = ["lambert","standardSurface","surfaceShader","phong","blinn"]
	for  type in  typeList:
		all_lambertList =cmds.ls(type=type)
		print all_lambertList
		for  lambert in all_lambertList: 
			fileName = cmds.defaultNavigation (defaultTraversal=1, destination = lambert + ".outColor")
			print(fileName)
			if fileName :
				mel.eval('generateUvTilePreview '  + fileName[0])
	cmds.setAttr ("hardwareRenderingGlobals.enableTextureMaxRes" , 1)
	cmds.setAttr ('hardwareRenderingGlobals.textureMaxResMode' , 1)
	cmds.setAttr ('hardwareRenderingGlobals.textureMaxResolution' , 1280)
	#mel.eval ("AEReloadAllTextures")
	mel.eval ('generateAllUvTilePreviews')
